AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")

function ENT:Initialize()
	self:SetModel("models/props_phx/ball.mdl")
	self:PhysicsInit(SOLID_NONE)
	self:SetMoveType(MOVETYPE_NONE)
	self:SetColor(255, 0, 0,10)
	self:SetMaterial("models/shadertest/shieldtint0")
	local phys = self:GetPhysicsObject()
	if phys:IsValid() then phys:Wake() end
	self:SetUseType(SIMPLE_USE)
	self.randomshits = {"gma_health", "gma_speed"} --@TODO Place this in shared config
end

function ENT:RemoveAllShits()
	for k, v in pairs(self.randomshits) do
		for a, b in pairs(ents.FindByClass(v)) do
			if ValidEntity(v) then
				v:Remove()
			end
		end
	end
end
function ENT:spawnRandomShit()
	if !VAR.MatchStarted then self:RemoveAllShits() return end
	
	local shit = ents.Create(self.randomshits[math.random(#self.randomshits)])
	shit:SetPos(self:GetPos())
	shit:Spawn()
	local effectdata = EffectData()
	effectdata:SetOrigin(self:GetPos())
	effectdata:SetMagnitude(5)
	effectdata:SetScale(1)
	effectdata:SetRadius(2)
	util.Effect("Sparks", effectdata)
end
